package com.atguigu.ssyx.product.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @作者:胡树苑
 * @时间:2025/9/13 14:26
 */
@Configuration
@ConfigurationProperties(prefix = "minio")
@Data
@Component
public class MinioConfig {

//    access-key: hushuyuan
//    secret-key: hsy@20040124
//    endpoint: http://localhost:9002
//    bucket: test

    private String accessKey;
    private String secretKey;
    private String endpoint;
    private String bucket;
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey,secretKey)
                .build();
    }

}
